home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr52 / mktouch.zip / MKTOUCH.PRG < prev   
Text File  |  1993-04-26  |  6KB  |  232 lines

  1. #pragma W_MAC_REDEF-
  2. #pragma W_FUNC_PROC-
  3.  
  4. #define GERMANS                     && Comment it, if you want an
  5.                          && english version ...
  6.  
  7. #include MKSYSTEM.HDR
  8. #include MKSTATUS.HDR
  9. #include MKSTRING.HDR
  10. #include MKSCREEN.HDR
  11. #include SYSTEM.HDR
  12. #include STRING.HDR
  13. #include MKFILE.HDR
  14. #include MKMISC.HDR
  15. #include MKTIME.HDR
  16. #include MKBIT.HDR
  17. #include DATE.HDR
  18. #include IO.HDR
  19.  
  20. VARDEF EXTERN
  21.    BYTE  __color_std
  22. ENDDEF
  23.  
  24. ********************************************************************************
  25.  
  26. PROCEDURE Help
  27.  
  28.    CLEAR
  29.    @ 01, 01 TO MaxRow() - 1, MaxCol() - 1 DOUBLE
  30.  
  31.    Bright()
  32.    @ 03, 30 ?? "MK Touch Version 1.0"
  33.    @ 04, 19 ?? "(C) 1992 by Unternehmensberatung Kalkhoff"
  34.    @ 05, 24 ?? "The FCO/Force File Touch Utility"
  35.    NoBright()
  36.  
  37.    #ifdef GERMANS
  38.    
  39.       @ 06, 09 ?? "Entwicklungssystem :  FCO Version 2.4 / MK Advanced Version 2.4"
  40.       @ 08, 04 ?? "Mittels dieses Utilities sind Sie in der Lage, das Datum und die Zeit von"
  41.       @ 09, 04 ?? "einzelnen Dateien oder Dateigruppen zu modifizieren. Im Gegensatz zu an-"
  42.       @ 10, 04 ?? "deren Tools kann hierbei das Datum und die Zeit frei bestimmt werden !!!"
  43.       Bright()
  44.       @ 12, 04 ?? "Anwendung : "
  45.       NoBright()
  46.                ?? "MKTouch <Dateiname> [/H] [/D<Datum>] [/T[Zeit>]"
  47.       @ 14, 04 ?? "Alle Parameter außer dem Dateiname bzw. -maske sind optional. Standard-"
  48.       @ 15, 04 ?? "mäßig wird das Systemdatum und die Systemzeit benutzt. Wildcards inner-"
  49.       @ 16, 04 ?? "halb des Dateinamens werden voll unterstützt ..."
  50.       Bright()
  51.       @ 18, 04 ?? "Beispiele : "
  52.       NoBright()
  53.                ?? "MKTouch *.*                     benutze Systemdatum und -zeit"
  54.       @ 19, 16 ?? "MKTouch \*.* /T12               setze Zeit auf 12:00:00 Uhr"
  55.       @ 20, 16 ?? "MKTouch *.* /T12 /D24.07.92     benutze definierte Werte"
  56.  
  57.       Bright()
  58.       @ 22, 25 ?? "Bitte beliebige Taste drücken ..."
  59.  
  60.    #else
  61.  
  62.       @ 06, 09 ?? "Development System :  FCO Version 2.4 / MK Advanced Version 2.4"
  63.       @ 08, 04 ?? "This utility allow you to touch the date and time of one or more files."
  64.       @ 09, 04 ?? "The difference to other tools is, that you can define the date and the"
  65.       @ 10, 04 ?? "time for the touch operation !!! Funny, eeeh ???"
  66.       Bright()
  67.       @ 12, 04 ?? "Usage    : "
  68.       NoBright()
  69.                ?? "MKTouch <filename> [/H] [/D<date>] [/T[time>]"
  70.       @ 14, 04 ?? "All parameters without the filename are optional. The default of time"
  71.       @ 15, 04 ?? "and date are the values from the System. Wildcards within the filename"
  72.       @ 16, 04 ?? "are allowed ..."
  73.       Bright()
  74.       @ 18, 04 ?? "Examples : "
  75.       NoBright()
  76.                ?? "MKTouch *.*                  use system's date and time"
  77.       @ 19, 15 ?? "MKTouch \*.* /T12            set time to 12:00:00"
  78.       @ 20, 15 ?? "MKTouch *.* /T12 /D24.07.92  use defined values"
  79.  
  80.       Bright()
  81.       @ 22, 25 ?? "press any key to continue ..."
  82.  
  83.    #endif
  84.  
  85.    Get_Key()
  86.    CLEAR
  87.    QUIT
  88.  
  89. ENDPRO
  90.  
  91. ********************************************************************************
  92.  
  93. PROCEDURE Usage
  94.  
  95.    #ifdef GERMANS
  96.       ? "Aufruf ist : MKTOUCH <Dateimaske> [/D<Datumsangabe>] [/T<Zeitangabe>]"
  97.       ? "             MKTOUCH /H für mehr Hilfe ..."
  98.    #else
  99.       ? "Usage is : MKTOUCH <file_mask> [</D<date_value>] [/T<time_value>]"
  100.       ? "           MKTOUCH /H for more help ..."
  101.    #endif
  102.    ?
  103.    QUIT
  104.  
  105. ENDPRO
  106.  
  107. ********************************************************************************
  108.  
  109. PROCEDURE Fco_Main
  110.  
  111.    VARDEF
  112.       DATE        touch_date
  113.       CHAR( 08 )  touch_time
  114.       CHAR( 128 ) touch_path
  115.       INT         touch_file
  116.       INT         i, params
  117.    ENDDEF
  118.  
  119.    #ifdef GERMANS                 && set date format in 
  120.       SetDate( &DATE_GERMAN )             && dependence of the language
  121.    #else
  122.       SetDate( &DATE_AMERICAN )
  123.    #endif
  124.  
  125.    __color_std = GetDosColor()             && initialize the variables
  126.    touch_date  = Today()             && with default values
  127.    touch_time  = Time()
  128.    params      = ParamCount()
  129.  
  130.    SetParamFormat( &PARAM_2UPPER )         && the function PARAMSTR 
  131.                          && returns now uppercase letters
  132.    Scrn_Bios()
  133.    Key_Dos()
  134.  
  135.    Bright()                     && display copyright ...
  136.    ? "MK Touch Version 1.0"
  137.    NoBright()
  138.    ? "(C) 1992 by Unternehmensberatung Kalkhoff"
  139.    ?
  140.  
  141.    IF params = 0                 && are there parameters ???
  142.                          && no, what for a shit ...
  143.       Usage()
  144.  
  145.    ELSE
  146.  
  147.       FOR i = 1 TO params             && process all parameters 
  148.  
  149.          touch_path = ParamStr( i )
  150.  
  151.          DO CASE
  152.             CASE Left( touch_path, 1 ) = "D"
  153.                touch_date = Ctod( Right( touch_path, Len( touch_path ) - 1 ) )
  154.  
  155.             CASE Left( touch_path, 1 ) = "T"
  156.                touch_time = Right( touch_path, Len( touch_path ) - 1 )
  157.  
  158.                IF .NOT. ValidTime( touch_time )
  159.  
  160.                   #ifdef GERMANS
  161.                       ? "ungültige Zeitangabe !!!"
  162.                   #else
  163.                       ? "invalid time !!!"
  164.                   #endif
  165.  
  166.                   Sound( 150, 2 )
  167.                   QUIT
  168.                    
  169.                ENDIF
  170.  
  171.             CASE Left( touch_path, 1 ) $ "H?"
  172.                Help()
  173.  
  174.             OTHERWISE                 && suppose that this is the
  175.                touch_file = i             && filename
  176.  
  177.          ENDCASE
  178.  
  179.       NEXT
  180.  
  181.    ENDIF
  182.  
  183.    touch_path = ""
  184.    i          = Rat( "\", ParamStr( touch_file ) )
  185.    
  186.    IF i > 0
  187.       touch_path = LEFT( ParamStr( touch_file ), i )
  188.    ELSE
  189.       i = AT( ":", ParamStr( touch_file ) )
  190.  
  191.       IF i > 0
  192.          touch_path = Left( ParamStr( touch_file ), i )
  193.       ENDIF
  194.  
  195.    ENDIF   
  196.  
  197.    i = 0
  198.  
  199.                          && process all files ...
  200.  
  201.    IF Find_First( ParamStr( touch_file ), &FIND_ANYFILE )
  202.  
  203.       REPEAT
  204.  
  205.          IF FTouch( touch_path + Find_FStr(), touch_date, touch_time )
  206.             i = i + 1
  207.          ENDIF
  208.  
  209.       UNTIL .NOT. Find_Next()
  210.  
  211.    ENDIF
  212.  
  213.    Bright()
  214.  
  215.    #ifdef GERMANS
  216.       ? i : 4, "Dateien bearbeitet ..."
  217.    #else
  218.       ? i : 4, "Files stamped ..."
  219.    #endif
  220.  
  221.    NoBright()
  222.  
  223.    #ifdef GERMANS
  224.       ? "Neue Erstellungszeit ist   :", touch_time
  225.       ? "Neues Erstellungsdatum ist :", touch_date
  226.    #else
  227.       ? "Touch time was :", touch_time
  228.       ? "Touch date was :", touch_date
  229.    #endif
  230.    ?
  231.  
  232. ENDPRO